package org.example.code.operation;

import org.example.code.entity.Goods;

import java.util.List;

public class Check {
    public boolean idCheck(List<Goods> list,Integer ID){
        for (Goods goods : list) {
            if(goods.getID().equals(ID)){
                System.out.println("重复的ID");
                return false;
            }
        }
        return true;
    }

    public boolean nameCheck(List<Goods> list,String name){
        for (Goods goods : list) {
            if(goods.getName().equals(name)){
                System.out.println("重复的名字");
                return false;
            }
        }
        return true;
    }


}
